﻿@{
    
    Layout = "~/Shared/Layouts/_Layout.cshtml";
    
    var productID = !UrlData[0].IsEmpty() ? UrlData[0] : "0";
    
    var db = Database.Open("VirtualeShop");   
    var sqlSelect = "SELECT * FROM Products WHERE productID = @0";
    
    var product = db.QuerySingle(sqlSelect, productID);
    
}

@if (product == null)
{
    <p>
        Unable to fetch product details. Неуспешно земање на деталите на продуктот.
        Обидете се да пребарате во некоја од лево излистаните категории.
    </p>
}
else
{
    Page.Title = product.title;
    <text>
        <h1>@product.title</h1>
        <div id="productDetails">
            <p class="price">
                £@product.price
            </p>
            <p>@Products.ShowProductImage(productID)</p>
            <p>@product.description</p>
        </div>
        <div id="orderForm">
            <form action="/Cart" method="post">
                <fieldset>
                    <legend>Нарачај</legend>
                    <p>
                        <label for="size">Број:</label>
                        <select name="size">
                            <option value="S">Мал</option>
                            <option value="M">Среден</option>
                            <option value="L">Голем</option>
                            <option value="XL">Екстра голем</option>
                        </select>
                    </p>
                    <p>
                        @Html.Hidden("productID", productID)
                        @Html.Hidden("price", product.price)
                        <input type="submit" value="Додади во кошничка" />
                    </p>
                </fieldset>
            </form>
            <fieldset>
                <legend>Сподели</legend>
                <!--<p>
                    @GooglePlusOne.PlusOneButton()
                </p>
                <p>
                    @Twitter.TweetButton(tweetText: "Check this out on the TechieTops site!", 
                                        userName: "stevelydford",
                                        dataCount: "horizontal")
                </p>-->
                <p>
                    @{ string currentUrl = Request.Url.ToString(); }
                    @Facebook.LikeButton(currentUrl, 
                                         width:230,
                                         buttonLayout:"standard", 
                                         height:25, 
                                         showFaces:false)
                </p>
            </fieldset>
        </div>
    </text>
}
